<template>
  <!-- 法规平台 -->
  <div class="app-container">
    <!-- <h1>法规平台</h1> -->
    <div class="boxlaw">
      <ComTable
        v-hasPermi="['market:depositPresent:edit']"
        @handleStatusChange="StatusChangeFn"
        @handleCurrentChange="CurrentPageChangeFn"
        @handleSizeChange="currentPageSizeChangeFn"
        :key="random"
        :list="tableList"
        :modes="tableModes"
        :config="{ border: true, loading }"
        :pagination="{ total: paging.total, pageNum: paging.pageNum }"
      >
      </ComTable>
    </div>
  </div>
</template>

<script>
import ComForm from "../../../components/comForm.vue";
import ComSelect from "../../../components/comSelect.vue";
import ComTable from "../../../components/comTable.vue";
import comForm from "../../../components/comForm.vue";
// import { getdocGetTypeApi } from "@/wss/api/ContentSupervision.js";

import {
  getConfigListTopUptApi,
  getConfigEditTopUpApi,
} from "@/wss/api/financial/Recharge/payAndRecharge.js";
export default {
  name: "laws",
  dicts: ["sys_normal_disable"],
  components: { ComSelect, ComForm, comForm, ComTable },

  data() {
    return {
      initSelectValue: "",
      // 加载
      loading: false,
      paging: { pageNum: 1, pageSize: 10, type: "t_way", total: 10 },
      // 切换筛选状态，不更新bug修复
      random: "",
      // 当前筛选的状态
      currentSelect: "",

      // 表格的数据
      tableList: [],
      tableModes: [
        {
          type: "selection",
        },
        {
          showOverflowTooltip: true,

          width: 200,
          label: "充值方式",
          mode: "name",
          showOverflowTooltip: true,
        },
        {
          label: "充值规则",
          mode: "value",
        },
        {
          label: "状态",
          mode: "status",
          showOverflowTooltip: true,
        },
        {
          label: "创建时间",
          mode: "createTime",
          // effectiveStatus: true,
          // width: 100,
          // align: "center",
          // isShowTag: true,
          // options: [
          //   {
          //     l: "有效",
          //     v: 0,
          //   },
          //   {
          //     l: "部分有效",
          //     v: 1,
          //     type: "warning",
          //   },
          //   {
          //     l: "失效",
          //     v: 2,
          //     type: "danger",
          //   },
          //   {
          //     l: "尚未生效",
          //     v: 3,
          //   },
          // ],
        },

        // {
        //   label: "审核",
        //   mode: "status",
        //   width: 100,
        //   align: "center",
        //   isShowTag: true,
        //   options: [
        //     {
        //       l: "待编辑",
        //       v: 0,
        //     },
        //     {
        //       l: "审核失败",
        //       v: 2,
        //       type: "danger",
        //     },
        //     {
        //       l: "审核中",
        //       v: 1,
        //       type: "warning",
        //     },
        //     {
        //       l: "成功",
        //       v: 4,
        //     },
        //   ],
        // },
      ],
    };
  },

  mounted() {
    this.getConfigListTopUptFn();
  },
  methods: {
    // 当前页发生改变时候
    CurrentPageChangeFn(pageNUm) {
      this.paging.pageNum = pageNUm;
      this.getConfigListTopUptFn();
    },
    // 页容量发生改变时候
    currentPageSizeChangeFn(pageSize) {
      this.paging.pageSize = pageSize;
      this.getConfigListTopUptFn();
    },

    // 获取列表数据
    async getConfigListTopUptFn() {
      this.loading = true;
      let { rows, code, total } = await getConfigListTopUptApi(this.paging);

      console.log(rows, "法规返回的数据");
      if (code == 200) {
        this.tableList = rows;
        this.paging.total = total;

        this.loading = false;
      }
    },
    // 修改
    async StatusChangeFn(row) {
      row.id = row.idStr;
      let { code, msg } = await getConfigEditTopUpApi([row]);
      if (code == 200) {
        this.$modal.msgSuccess(msg);
        this.getConfigListTopUptFn();
      }
      // console.log(result);
    },
  },
};
</script>

<style lang ="scss" scoped>
.comform {
  margin-top: 20px;
}
</style>